<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="button" id="bt" 点我>
    <script>
        //箭头函数*****类似于1.8匿名函数 es6新特性143
        var fn143=args=>args;
        var fn1=()=>{

        };
        ()=>{

        }
        var shuzu1=new Array();
        shuzu1.forEach(function(xjj,index,shuzu1){

        });
        shuzu1.forEach(()=>{

        });
        shuzu1.forEach(xjj=>console.log(xjj));
        
        function ffff(args){
            return args;
        }



        var f=k=> console.log(k);
       f(8);
        let j=()=>console.log("wrett2345");
        j();
        var arr=new Array(1,2,3,4,5,6);
        arr.forEach(xjj=>xjj>3?console.log(xjj):'');
        arr.forEach(function(xjj,index,arr){
            console.log(xjj);
        });
        document.getElementById("bt").addEventListener("clikc",
        ()=>{
            
        });


        //暂时性死亡区
        if (true) {
    // 暂时性死区开始
   // tmp = 'abc'; // ReferenceError
    //console.log(tmp); // ReferenceError
    // let tmp; // TDZ结束
    // console.log(tmp); // undefined
    // tmp = 123;
    // console.log(tmp); // 123
}
//let不可以重复，var可以重复申明
// function f1() {
//     let n = 5;
//     if (true) {
//         let n = 10;
//     }
//     console.log(n); // 5
// }
// f1();
// function f1() {
//     const m = 10;
//     if (true) {
//         let n = 10;
//        // m = 20;
//     }
//     console.log(n); // 5
// }
// f1();
//解构
let[a1,b1]=[143,151];
console.log(b1);
 let[a2,b2,c4,...c3]=[1,2,3,4,5,6,7];//...入参数组，代表一切剩下的
 console.log(c3);
 let [a3, [b3], c31] = [1, [2, 3,4], 4];
 console.log("b3:"+b3);//我没有讲的就是站位，站位哪里拿值即可
 //
 {let [x, y='7'] = ['8']; //站位 带了默认值的就用（除非覆盖）
 var [x1,y1]=[8,9];
}
//console.log(y);console.log(y1);
//对象解构
 let{q,w}={q:'qq',y:'y'};//对象要11对应
 console.log(q);
 let obj={
     x:["hello",{y:'wordld'}]
 }
 let obj1={
    x:"1",y:"2"
 }
  console.log("x；"+obj1.y);
  let {a4,b4,c5,...rest}={a4:"3",b4:"4",c5:"6",d:"7",v:"9"};
  console.log(rest);
//函数解构
function add([x,y]){
    console.log(x+y);
}
add([3,4]);
function move(x,y){
    console.log(x,y);
}
move(3);
//默认值函数修改为git
function d(x,y){
    y=y||'143';
    console.log(x,y);
}
d(1,44);

//json {k:v,k:v,k:v}  user{id:1,name:"超哥",age:32}序列化和反序列的桥梁json
//user[{id:1,name:"超哥",age:32},{id:2,name:"超哥2",age:33}]
        {
            var a=1;
            let b=2;
        }
        console.log(a);
        console.log(b);

    </script>
</body>
</html>